%table
  %tr
    %td Comment
    %td= @raid.comment
  %tr
    %td Date
    %td= @raid.date.strftime("%d %b %Y %H:%M")

%br

%h3 Signups
- if (@raid.wanted_roles.length > 0)
  %table
    %tr
      - @raid.wanted_roles.each do |wanted_role|
        %th= wanted_role.role.name
    %tr
      - @raid.wanted_roles.each do |wanted_role|
        - still_wanted = wanted_role.count
        %td{:valign => "top"}
          %table
            - (@raid.signups.select { |s| s.accepted? }).each do |signup|
              - if signup.character.roles.include?(wanted_role.role)
                %tr{:class => "taken-spot"}
                  = render(:partial => signup.character, :locals => { :character => signup.character })
                - still_wanted = still_wanted - 1
            - (1..still_wanted).each do
              %tr{:class => "open-spot"}
                %td [unfilled]
  %br

- if (is_member? and still_got_time_to_signup_for_raid?(@raid))
  - unless @signed_up_for_this_raid
    - form_tag(:controller => "raids", :action => :create_signup, :raid_id => @raid.id) do
      = submit_tag("Sign me up")
  - if @signed_up_for_this_raid
    You have signed up for this raid.
  %br

- if (@raid.rewards.length > 0)
  %h3 Rewards
  %table
    %tr
      %th Mob
      %th Comment
      %th Shares
    %tr
    - @raid.rewards.each do |reward|
      %tr
        %td
          - if reward.mob
            = link_to(reward.mob.name, :action => :show, :controller => "rewards", :id => reward.id)
        %td= link_to(reward.comment, :action => :show, :controller => "rewards", :id => reward.id)
        %td= reward.number_of_shares
  %br

- if (@raid.loot.length > 0)
  %h3 Loot
  %table
    %tr
      %th Winner
      %th Item
      %th Dropped by
      %th Price
    - @raid.loot.each do |loot|
      %tr
        = render(:partial => loot.character, :locals => { :character => loot.character })
        = render(:partial => loot.item, :locals => { :item => loot.item })
        - if loot.mob
          = render(:partial => loot.mob, :locals => { :mob => loot.mob })
        - else
          %td
        %td= number_with_precision(loot.price)
